package com.gis.halodepok;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class MenuBank extends ListActivity {



	


	@Override
	 protected void onCreate(Bundle savedInstanceState) {
	  super.onCreate(savedInstanceState);
	  String[] values = new String[] {"BCA","Bank DKI","BRI","BNI","Danamon","Mandiri"};
	  setContentView(R.layout.listmenu);
	  ArrayAdapter adapter = new ArrayAdapter(MenuBank.this,android.R.layout.simple_list_item_1, values);
		setListAdapter(adapter);
	 
	 
	 }

	
	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		// TODO Auto-generated method stub
		super.onListItemClick(l, v, position, id);
		
		Object bank = this.getListAdapter().getItem(position);
		String pilihan = bank.toString();
		tampilkanBank (pilihan);
	}
	
	protected void tampilkanBank (String pilihan) {
		try {
		 Intent i = null;
		 if (pilihan.equals("BCA")) {
	     i = new Intent (this,Bca.class); }
		 else if (pilihan.equals("Bank DKI")) {
		     i = new Intent (this,Dki.class); }
		 else if (pilihan.equals("BNI")) {
		     i = new Intent (this,Bni.class); }
		 else if (pilihan.equals("BRI")) {
		     i = new Intent (this,Bri.class); }
		 else if (pilihan.equals("Danamon")) {
		     i = new Intent (this,Danamon.class); }
		 else if (pilihan.equals("Mandiri")) {
		     i = new Intent (this,Mandiri.class); }
		 
		 startActivity (i); 
		}
		
		catch (Exception e) {
		e.printStackTrace();	
		}
		 
			
	}



	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
